﻿Imports MySql.Data.MySqlClient
Public Class frmadd_booking
    Dim mySqlCommand As New MySqlCommand
    Dim mySqlAdaptor As New MySqlDataAdapter
    Dim mySqlReader As MySqlDataReader
    Dim inbtIndex As Integer
    Dim idlast As Integer
    Dim idlast1 As Integer
    Dim respone As Object
    Dim mysql As MySqlConnection = main_form.mysqlconection
    Dim consigneeid As String
    Dim shippingid As String
    Dim forwarderid As String
    Dim idconsignee As String = "0"
    Dim checkINV As String

    Dim fedstr As String = " "
    Dim fedboo As String = " "

    Dim mothstr As String = " "
    Dim mothboo As String = " "

    Dim ptranshipstr As String = " "
    Dim ptranshipboo As String = " "

    Dim ptranshipstr2 As String = " "
    Dim ptranshipboo2 As String = " "

    Dim dischargestr As String = " "
    Dim dischargeboo As String = " "

    Dim pdeliverlystr As String = " "
    Dim pdeliverlyboo As String = " "

    Dim fdestinationstr As String = " "
    Dim fdestinationboo As String = " "


    Dim nicknameforward As String = " "
    Dim nicknameshipname As String = " "


    Private Sub frmadd_booking_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        mysql.Close()
        System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US")
        System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture


        If mysql.State = ConnectionState.Closed Then
            mysql.Open()
        End If


        mySqlCommand.CommandText = "Select * from shipper;"
        mySqlCommand.Connection = mysql
        mySqlAdaptor.SelectCommand = mySqlCommand

        Try
            mySqlReader = mySqlCommand.ExecuteReader

            While (mySqlReader.Read())
                ComboBox2.Items.Add(mySqlReader("SHIPNAME"))

            End While
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
        mysql.Close()


     

        If mysql.State = ConnectionState.Closed Then
            mysql.Open()
        End If


        mySqlCommand.CommandText = "Select * from shipper;"
        mySqlCommand.Connection = mysql
        mySqlAdaptor.SelectCommand = mySqlCommand

        Try
            mySqlReader = mySqlCommand.ExecuteReader

            While (mySqlReader.Read())
                ComboBox3.Items.Add(mySqlReader("SHIPNAME"))

            End While
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
        mysql.Close()

        txt_booking_no.Focus()
        txt_booking_no.Select()


        If mysql.State = ConnectionState.Closed Then
            mysql.Open()
        End If


        mySqlCommand.CommandText = "Select * from consignee;"
        mySqlCommand.Connection = mysql
        mySqlAdaptor.SelectCommand = mySqlCommand

        Try
            mySqlReader = mySqlCommand.ExecuteReader

            While (mySqlReader.Read())
                ComboBox1.Items.Add(mySqlReader("CONNAME"))

            End While
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
        mysql.Close()




    End Sub

 
    Sub ChangFocus(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txt_booking_no.KeyPress, txt_notify.KeyPress, txt_scn.KeyPress, txt_comodity.KeyPress, txt_TUG.KeyPress, txt_Gross.KeyPress, txt_localforwared.KeyPress, txt_remark.KeyPress, txt_TUG.KeyPress, txt_type.KeyPress
        If e.KeyChar = Microsoft.VisualBasic.ChrW(13) Then
            SendKeys.Send("{TAB}")
            e.Handled = True
        End If
    End Sub

    Private Sub ComboBox2_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ComboBox2.KeyDown
        If e.KeyCode = Keys.Enter Then
            mysql.Close()
            Dim check1 As String = "0"

            If mysql.State = ConnectionState.Closed Then
                mysql.Open()
            End If
            mySqlCommand.CommandText = "Select  count(shipperid) as ship from  shipper where SHIPNAME like '%" & Trim(ComboBox2.Text) & "%';"
            mySqlCommand.Connection = mysql
            mySqlAdaptor.SelectCommand = mySqlCommand

            Try
                mySqlReader = mySqlCommand.ExecuteReader

                'MsgBox(mySqlReader.FieldCount.ToString)
                While (mySqlReader.Read())

                    check1 = mySqlReader("ship")


                End While
            Catch ex As Exception
                MsgBox(ex.ToString)
            End Try
            If check1 = "1" Then
                mysql.Close()
                If mysql.State = ConnectionState.Closed Then
                    mysql.Open()
                End If
                mySqlCommand.CommandText = "Select  * from  shipper where SHIPNAME like '" & Trim(ComboBox2.Text) & "%';"
                mySqlCommand.Connection = mysql
                mySqlAdaptor.SelectCommand = mySqlCommand

                Try
                    mySqlReader = mySqlCommand.ExecuteReader

                    'MsgBox(mySqlReader.FieldCount.ToString)
                    While (mySqlReader.Read())
                        shippingid = mySqlReader("SHIPPERID")
                        ComboBox2.Text = mySqlReader("SHIPNAME")
                        TextBox2.Text = mySqlReader("SHIPADD")
                        nicknameshipname = mySqlReader("SHIPNICKNAME")
                    End While
                Catch ex As Exception

                End Try

            End If

        End If

   

    End Sub



    Private Sub ComboBox2_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedValueChanged

        mysql.Close()

        If mysql.State = ConnectionState.Closed Then
            mysql.Open()
        End If

        mySqlCommand.CommandText = "Select * from  shipper where SHIPNAME = '" & Trim(ComboBox2.Text) & "';"
        mySqlCommand.Connection = mysql
        mySqlAdaptor.SelectCommand = mySqlCommand

        Try
            mySqlReader = mySqlCommand.ExecuteReader

            While (mySqlReader.Read())
                shippingid = mySqlReader("SHIPPERID")
                ComboBox2.Text = mySqlReader("SHIPNAME")
                TextBox2.Text = mySqlReader("SHIPADD")
                nicknameshipname = mySqlReader("SHIPNICKNAME")
            End While
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
        mysql.Close()
    End Sub

    Private Sub ComboBox3_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ComboBox3.KeyDown
        If e.KeyCode = Keys.Enter Then
            Dim check1 As String = "0"
            mysql.Close()

            If mysql.State = ConnectionState.Closed Then
                mysql.Open()
            End If

            mySqlCommand.CommandText = "Select  count(shipperid) as ship  from  shipper where SHIPNAME like '%" & Trim(ComboBox3.Text) & "%';"
            mySqlCommand.Connection = mysql
            mySqlAdaptor.SelectCommand = mySqlCommand

            Try
                mySqlReader = mySqlCommand.ExecuteReader

                'MsgBox(mySqlReader.FieldCount.ToString)
                While (mySqlReader.Read())

                    check1 = mySqlReader("ship")


                End While
            Catch ex As Exception

            End Try
            If check1 = "1" Then
                mysql.Close()

                If mysql.State = ConnectionState.Closed Then
                    mysql.Open()
                End If

                mySqlCommand.CommandText = "Select *   from  shipper where SHIPNAME like '" & Trim(ComboBox3.Text) & "%';"
                mySqlCommand.Connection = mysql
                mySqlAdaptor.SelectCommand = mySqlCommand

                Try
                    mySqlReader = mySqlCommand.ExecuteReader

                    'MsgBox(mySqlReader.FieldCount.ToString)
                    While (mySqlReader.Read())
                        forwarderid = mySqlReader("SHIPPERID")
                        ComboBox3.Text = mySqlReader("SHIPNAME")
                        TextBox1.Text = mySqlReader("SHIPADD")
                        nicknameforward = mySqlReader("SHIPNICKNAME")


                    End While
                Catch ex As Exception

                End Try
            End If


        End If

        mysql.Close()

    End Sub



    Private Sub ComboBox3_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox3.SelectedValueChanged
        mysql.Close()
        If mysql.State = ConnectionState.Closed Then
            mysql.Open()
        End If

        mySqlCommand.CommandText = "Select * from  shipper where SHIPNAME = '" & Trim(ComboBox3.Text) & "';"
        mySqlCommand.Connection = mysql
        mySqlAdaptor.SelectCommand = mySqlCommand

        Try
            mySqlReader = mySqlCommand.ExecuteReader

            While (mySqlReader.Read())
                forwarderid = mySqlReader("SHIPPERID")
                ComboBox3.Text = mySqlReader("SHIPNAME")
                TextBox1.Text = mySqlReader("SHIPADD")
                nicknameforward = mySqlReader("SHIPNICKNAME")
            End While
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
        mysql.Close()
    End Sub

    Private Sub ButtonX1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX1.Click
        Dim cf As New frmview_voyage
        cf.MdiParent = Me.MdiParent
        Me.Close()
        cf.Dock = DockStyle.Fill
        cf.Show()
    End Sub

   

    Private Sub ButtonX2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX2.Click



        mysql.Close()
        mySqlCommand = New MySqlCommand
        If mysql.State = ConnectionState.Closed Then
            mysql.Open()
        End If

        respone = MsgBox("ยืนยันข้อมูลถูกต้อง", MsgBoxStyle.OkCancel + MsgBoxStyle.Information, "Warning Messsage")
        If respone = 1 Then
            Try
                mySqlCommand.Parameters.Clear()
                mySqlCommand.CommandText = "insert into booking (BNO, BLANDNO, BCTNNO,BCTNTYPE,BCTNWORD, BNOTIFY, BSCN, BCOM, BDESCRIPT, BTYPEMOVE, BCONSI, BSHIP, BTUG, BGROSS,BLOCALFOR,BVOYAGE,BSHIPNAME,BCONSINAME,POL,TSPORT,REMARK,BFORWARDER,BFORWARDERNAME, BPORTDIS,BPORTDISS, BFINALDEST,BFINALDESTS,BFED,BFEDS,BMOTH,BMOTHS,BTRANSHIP,BTRANSHIPS,BTRANSHIP2,BTRANSHIP2S,BDELIVERY,BDELIVERYS,BNSHIPNAME, BNFORWARDERNAME,BNICKAGENT,BCHECKLOAD,BINVOICE,BINCOTERM,BREMARK) values (@BNO,@BLANDNO,@BCTNNO,@BCTNTYPE,@BCTNWORD,@BNOTIFY,@BSCN,@BCOM,@BDESCRIPT,@BTYPEMOVE,@BCONSI,@BSHIP,@BTUG,@BGROSS,@BLOCALFOR,@BVOYAGE,@BSHIPNAME,@BCONSINAME,@POL,@TSPORT,@REMARK,@BFORWARDER,@BFORWARDERNAME,@BPORTDIS,@BPORTDISS,@BFINALDEST,@BFINALDESTS,@BFED,@BFEDS,@BMOTH,@BMOTHS,@BTRANSHIP,@BTRANSHIPS,@BTRANSHIP2,@BTRANSHIP2S,@BDELIVERY,@BDELIVERYS,@BNSHIPNAME,@BNFORWARDERNAME,@BNICKAGENT,@BCHECKLOAD,@BINVOICE,@BINCOTERM,@BREMARK);SELECT LAST_INSERT_ID();"
                mySqlCommand.Connection = mysql
                mySqlCommand.Parameters.AddWithValue("@BNICKAGENT", Trim(TextBox5.Text))


                mySqlCommand.Parameters.AddWithValue("@BNO", Trim(txt_booking_no.Text))
                mySqlCommand.Parameters.AddWithValue("@BLANDNO", Trim(TextBox3.Text))
                mySqlCommand.Parameters.AddWithValue("@BCTNNO", TextBox4.Text)
                mySqlCommand.Parameters.AddWithValue("@BCTNTYPE", Trim(txt_type.Text))
                mySqlCommand.Parameters.AddWithValue("@BCTNWORD", "")
                mySqlCommand.Parameters.AddWithValue("@BNOTIFY", Trim(txt_notify.Text))
                mySqlCommand.Parameters.AddWithValue("@BSCN", Trim(txt_scn.Text))
                mySqlCommand.Parameters.AddWithValue("@BCOM", Trim(txt_comodity.Text))
                mySqlCommand.Parameters.AddWithValue("@BDESCRIPT", Trim(txt_descript.Text))
                mySqlCommand.Parameters.AddWithValue("@POL", Trim(txt_pol.Text))
                mySqlCommand.Parameters.AddWithValue("@TSPORT", Trim(txt_tsport.Text))
                mySqlCommand.Parameters.AddWithValue("@REMARK", Trim(txt_remark.Text))

                mySqlCommand.Parameters.AddWithValue("@BVOYAGE", Trim(frmsearch_voyage1.idvoyage))
                If RadioButton1.Checked = True Then
                    mySqlCommand.Parameters.AddWithValue("@BTYPEMOVE", "1")
                ElseIf RadioButton2.Checked = True Then
                    mySqlCommand.Parameters.AddWithValue("@BTYPEMOVE", "2")
                Else
                    mySqlCommand.Parameters.AddWithValue("@BTYPEMOVE", "0")
                End If

                mySqlCommand.Parameters.AddWithValue("@BCONSI", Trim(consigneeid))
                mySqlCommand.Parameters.AddWithValue("@BSHIP", Trim(shippingid))
                mySqlCommand.Parameters.AddWithValue("@BFORWARDER", Trim(forwarderid))


                mySqlCommand.Parameters.AddWithValue("@BTUG", Trim(txt_TUG.Text))
                mySqlCommand.Parameters.AddWithValue("@BGROSS", Trim(txt_Gross.Text))

                mySqlCommand.Parameters.AddWithValue("@BLOCALFOR", Trim(txt_localforwared.Text))
                mySqlCommand.Parameters.AddWithValue("@BCONSINAME", Trim(""))
                mySqlCommand.Parameters.AddWithValue("@BSHIPNAME", Trim(ComboBox2.Text))
                mySqlCommand.Parameters.AddWithValue("@BFORWARDERNAME", Trim(ComboBox3.Text))

                mySqlCommand.Parameters.AddWithValue("@BPORTDIS", dischargestr)
                mySqlCommand.Parameters.AddWithValue("@BPORTDISS", dischargeboo)

                mySqlCommand.Parameters.AddWithValue("@BFINALDEST", fdestinationstr)
                mySqlCommand.Parameters.AddWithValue("@BFINALDESTS", fdestinationboo)

                mySqlCommand.Parameters.AddWithValue("@BFED", fedstr)
                mySqlCommand.Parameters.AddWithValue("@BFEDS", fedboo)

                mySqlCommand.Parameters.AddWithValue("@BMOTH", TextBoxX6.Text)
                mySqlCommand.Parameters.AddWithValue("@BMOTHS", mothboo)

                mySqlCommand.Parameters.AddWithValue("@BTRANSHIP", ptranshipstr)
                mySqlCommand.Parameters.AddWithValue("@BTRANSHIPS", ptranshipboo)

                mySqlCommand.Parameters.AddWithValue("@BTRANSHIP2", ptranshipstr2)
                mySqlCommand.Parameters.AddWithValue("@BTRANSHIP2S", ptranshipboo2)
                mySqlCommand.Parameters.AddWithValue("@BDELIVERY", pdeliverlystr)
                mySqlCommand.Parameters.AddWithValue("@BDELIVERYS", pdeliverlyboo)
                mySqlCommand.Parameters.AddWithValue("@BNSHIPNAME", nicknameshipname)
                mySqlCommand.Parameters.AddWithValue("@BNFORWARDERNAME", nicknameforward)


                If RadioButton5.Checked = True Then
                    checkINV = "True"

                ElseIf RadioButton6.Checked = True Then
                    checkINV = "False"

                End If

                mySqlCommand.Parameters.AddWithValue("@BCHECKLOAD", checkINV)
                mySqlCommand.Parameters.AddWithValue("@BINVOICE", TextBoxX2.Text)
                mySqlCommand.Parameters.AddWithValue("@BINCOTERM", TextBoxX4.Text)
                mySqlCommand.Parameters.AddWithValue("@BREMARK", TextBoxX5.Text)


                idlast = mySqlCommand.ExecuteScalar()
                mysql.Close()


                MsgBox("Save Complete")
            Catch ex As Exception
                MsgBox(ex.ToString)
            End Try
        End If



       


        If DataGridViewX1.Rows.Count > 0 Then
            For i = 0 To DataGridViewX1.Rows.Count - 2
                If mysql.State = ConnectionState.Closed Then
                    mysql.Open()
                End If
                Try
                    mySqlCommand.Parameters.Clear()
                    mySqlCommand.CommandText = "insert into booking_bl_ctn (idnumber, bookid, name_1, name_2) values (@idnumber,@bookid,@name_1,@name_2)"
                    mySqlCommand.Connection = mysql


                    mySqlCommand.Parameters.AddWithValue("@idnumber", i)
                    mySqlCommand.Parameters.AddWithValue("@bookid", idlast)
                    mySqlCommand.Parameters.AddWithValue("@name_1", DataGridViewX1.Rows(i).Cells(0).Value)
                    mySqlCommand.Parameters.AddWithValue("@name_2", DataGridViewX1.Rows(i).Cells(1).Value)
                    mySqlCommand.ExecuteNonQuery()
                    mysql.Close()
                Catch ex As Exception
                    MsgBox(ex.ToString)
                End Try

                mysql.Close()
            Next

        End If


        mySqlCommand = New MySqlCommand
        If mysql.State = ConnectionState.Closed Then
            mysql.Open()
        End If

        If idconsignee <> "0" Then
            Try

                mysql.Close()
                If mysql.State = ConnectionState.Closed Then
                    mysql.Open()
                End If
                mySqlCommand.Parameters.Clear()
                mySqlCommand.CommandText = "insert into booking_bl (billbooking, number, place, conid,conname,conaddress,booking_id,number_word) values (@billbooking,@number,@place,@conid,@conname,@conaddress,@booking_id,@number_word);  SELECT LAST_INSERT_ID()"
                mySqlCommand.Connection = mysql


                mySqlCommand.Parameters.AddWithValue("@billbooking", TextBoxX3.Text)
                mySqlCommand.Parameters.AddWithValue("@number", TextBoxX13.Text)
                mySqlCommand.Parameters.AddWithValue("@place", TextBoxX7.Text)
                mySqlCommand.Parameters.AddWithValue("@conid", idconsignee)
                mySqlCommand.Parameters.AddWithValue("@conname", ComboBox3.Text)
                mySqlCommand.Parameters.AddWithValue("@conaddress", TextBox1.Text)
                mySqlCommand.Parameters.AddWithValue("@booking_id", idlast)
                mySqlCommand.Parameters.AddWithValue("@number_word", TextBoxX1.Text)
                idlast1 = mySqlCommand.ExecuteScalar()



                mysql.Close()
                If mysql.State = ConnectionState.Closed Then
                    mysql.Open()
                End If


                mySqlCommand.CommandText = "UPDATE booking SET BINV='" & idlast1 & "'   WHERE BOOKINGID = '" & idlast & "'; "

                mySqlCommand.CommandType = CommandType.Text
                mySqlCommand.Connection = mysql

                mySqlCommand.ExecuteNonQuery()
                mysql.Close()

                mysql.Close()
                MsgBox("Save Complete")
            Catch ex As Exception
                MsgBox(ex.ToString)
            End Try

            mysql.Close()


        End If
 




        Dim cf As New frmview_voyage
        cf.MdiParent = Me.MdiParent
        Me.Close()
        cf.Dock = DockStyle.Fill
        cf.Show()
    End Sub

    Private Sub DataGridViewX1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridViewX1.CellClick
        inbtIndex = e.RowIndex
    End Sub



    Private Sub DataGridViewX1_CellMouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridViewX1.CellMouseDown

        inbtIndex = e.RowIndex
        Try
            Dim rowClicked As DataGridView.HitTestInfo = DataGridViewX1.HitTest(e.X, e.Y)
            'Select Right Clicked Row if its not the header row
            If e.Button = Windows.Forms.MouseButtons.Right AndAlso e.RowIndex > -1 Then
                'Clear any currently sellected rows
                DataGridViewX1.CurrentCell = DataGridViewX1.Rows(e.RowIndex).Cells(e.ColumnIndex)

                ContextMenuStrip1.Show(DataGridViewX1, New Point(e.RowIndex, e.ColumnIndex))

            End If
        Catch ex As Exception

        End Try



    End Sub

    Private Sub Mark_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Mark.Click
        DataGridViewX1.Rows.Remove(DataGridViewX1.CurrentRow)
    End Sub

    Private Sub ComboBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ComboBox1.KeyDown
        If e.KeyCode = Keys.Enter Then
            Dim check1 As String = "0"
            mysql.Close()

            If mysql.State = ConnectionState.Closed Then
                mysql.Open()
            End If

            mySqlCommand.CommandText = "Select  count(CONSIGNEEID) as ship  from  consignee where CONNAME like '%" & Trim(ComboBox1.Text) & "%';"
            mySqlCommand.Connection = mysql
            mySqlAdaptor.SelectCommand = mySqlCommand

            Try
                mySqlReader = mySqlCommand.ExecuteReader

                'MsgBox(mySqlReader.FieldCount.ToString)
                While (mySqlReader.Read())

                    check1 = mySqlReader("ship")


                End While
            Catch ex As Exception

            End Try
            If check1 = "1" Then
                mysql.Close()

                If mysql.State = ConnectionState.Closed Then
                    mysql.Open()
                End If

                mySqlCommand.CommandText = "Select *   from  consignee where CONNAME like '" & Trim(ComboBox1.Text) & "%';"
                mySqlCommand.Connection = mysql
                mySqlAdaptor.SelectCommand = mySqlCommand

                Try
                    mySqlReader = mySqlCommand.ExecuteReader

                    'MsgBox(mySqlReader.FieldCount.ToString)
                    While (mySqlReader.Read())
                      idconsignee = mySqlReader("CONSIGNEEID")
                        ComboBox1.Text = mySqlReader("CONNAME")
                        TextBox6.Text = mySqlReader("CONADD")


                    End While
                Catch ex As Exception

                End Try
            End If


        End If

        mysql.Close()


    End Sub

    Private Sub ComboBox1_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedValueChanged
        mysql.Close()
        If mysql.State = ConnectionState.Closed Then
            mysql.Open()
        End If

        mySqlCommand.CommandText = "Select * from  consignee where CONNAME = '" & Trim(ComboBox1.Text) & "';"
        mySqlCommand.Connection = mysql
        mySqlAdaptor.SelectCommand = mySqlCommand

        Try
            mySqlReader = mySqlCommand.ExecuteReader

            While (mySqlReader.Read())
                idconsignee = mySqlReader("CONSIGNEEID")
                ComboBox1.Text = mySqlReader("CONNAME")
                TextBox6.Text = mySqlReader("CONADD")
            End While
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
        mysql.Close()
    End Sub

    Private Sub TextBoxX13_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBoxX13.KeyDown
        If e.KeyCode = Keys.Enter Then
            TextBoxX1.Text = AmtInWord(TextBoxX13.Text)
        Else

        End If
    End Sub

    Private Sub RadioButton5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton5.CheckedChanged
        TextBoxX2.ReadOnly = False
        TextBoxX4.ReadOnly = False
        TextBoxX5.ReadOnly = False

    End Sub

    Private Sub RadioButton6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton6.CheckedChanged
        TextBoxX2.ReadOnly = True
        TextBoxX4.ReadOnly = True
        TextBoxX5.ReadOnly = True
    End Sub

    Private Sub GroupBox9_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox9.Enter

    End Sub

    Private Sub MotherVesselToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MotherVesselToolStripMenuItem.Click
        TextBoxX6.Text = DataGridViewX1.Rows(inbtIndex).Cells(1).Value
    End Sub
End Class